/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package quizzempire.model;

import java.io.Serializable;
import java.util.ArrayList;

/**
 *
 * @author Victor
 */
public class Quizz implements IQuizz, Serializable {
    //---------- ATTRIBUTES ---------

    String name = "";
    String genre = "";
    String author = "";
    String description = "";
    String password = "";
    int[] numQuestionsLevel = new int[]{0, 0, 0};
    boolean[] difAvailable = new boolean[]{false, false, false};
    ArrayList<Question> questions = new ArrayList();

    //---------- METHODS ---------
    @Override
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String getGenre() {
        return genre;
    }

    public void setGenre(String genre) {
        this.genre = genre;
    }

    @Override
    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    @Override
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    // --- será melhor fazer um get para cada dificuldade ou assim ta bom?
    @Override
    public int[] getNumQuestionsLevel() {
        return numQuestionsLevel;
    }

    public void setNumEasy(int numEasy) {
        numQuestionsLevel[0] = numEasy;
    }

    public void setNumNormal(int numNormal) {
        numQuestionsLevel[1] = numNormal;
    }

    public void setNumHard(int numHard) {
        numQuestionsLevel[2] = numHard;
    }

    public void setDifAvailable(boolean[] difAvailable) {
        this.difAvailable = difAvailable;
    }
  
    @Override
    public boolean[] getDifAvailable() {
        return difAvailable;
    }

    public void toggleEasy() {
        difAvailable[0] = !difAvailable[0];
    }

    public void toogleNormal() {
        difAvailable[1] = !difAvailable[1];
    }

    public void toogleHard() {
        difAvailable[2] = !difAvailable[2];
    }

    public ArrayList<Question> getQuestions() {
        return questions;
    }

    public void addQuestion(Question question) {
        questions.add(question);
    }

    public void removeQuestion(int idQuestion) {
        questions.remove(idQuestion);
    }

    @Override
    public ArrayList<IQuestion> getQuestionsViewer() {
        return new ArrayList<>(questions);
    }

}
